#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include <stdlib.h>

typedef struct {
    int height;
} Student;

int main() {
    int n;
    scanf("%d", &n);

    Student** matrix = (Student**)malloc(n * sizeof(Student*));
    for (int i = 0; i < n; i++) {
        matrix[i] = (Student*)malloc(n * sizeof(Student));
        for (int j = 0; j < n; j++) {
            scanf("%d", &matrix[i][j].height);
        }
    }

    for (int i = 0; i < n; i++) {
        printf("%d\n", matrix[i][i].height);
    }

    for (int i = 0; i < n; i++) {
        free(matrix[i]);
    }
    free(matrix);

    return 0;
}
